﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace TestByWire.Test
{
	[TestClass]
	public class ResetStubAttributeTest
	{
		[TestMethod]
		public void ConstructorMustNotAcceptNullAsInterfaceType()
		{
			var exception = AssertEx.Throws<ArgumentNullException>(() => new ResetStubAttribute(default(Type)));

			Assert.AreEqual("interfaceType", exception.ParamName);
		}

		[TestMethod]
		public void ConstructorMustNotAcceptEmptyStringAsFieldName()
		{
			AssertEx.Throws<ArgumentException>(() => new ResetStubAttribute(typeof(String), string.Empty));

		}

        [TestMethod]
        public void Inheritance()
        {
			Assert.IsInstanceOfType(new ResetStubAttribute(typeof(String), "Foo"), typeof(IContainerInteraction));
        }

        [TestMethod]
        public void TypeNotSet_RegisteredOnType()
        {
            IContainerInteraction target = new ResetStubAttribute(typeof(IMyClass));
            Assert.AreEqual(typeof(IMyClass), target.RegistrationType);
            Assert.IsNull(target.RegistrationName);
        }

	}
}
